import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  //  {
  //   title: '组织id',
  //   align:"center",
  //   dataIndex: 'organizationId',
  //  },
  //  {
  //   title: '租户id',
  //   align:"center",
  //   dataIndex: 'tenantId'
  //  },
  //  {
  //   title: '删除状态',//0正常 1已删除
  //   align:"center",
  //   dataIndex: 'delFlag'
  //  },
  //  {
  //   title: '单据类型ID',
  //   align:"center",
  //   dataIndex: 'billTypeId'
  //  },
   {
    title: '单据类型',
    align:"center",
    dataIndex: 'billTypeName'
   },
  //  {
  //   title: '来源id',
  //   align:"center",
  //   dataIndex: 'srcBillId'
  //  },
  //  {
  //   title: '来源类型',
  //   align:"center",
  //   dataIndex: 'srcBillType'
  //  },
  //  {
  //   title: '来源单据编号',
  //   align:"center",
  //   dataIndex: 'srcBillCode'
  //  },
  //  {
  //   title: '来源行号',
  //   align:"center",
  //   dataIndex: 'srcRowNumber'
  //  },
  //  {
  //   title: '源头单据ID',
  //   align:"center",
  //   dataIndex: 'firstBillId'
  //  },
  //  {
  //   title: '源头单据编号',
  //   align:"center",
  //   dataIndex: 'firstBillCode'
  //  },
  //  {
  //   title: '源头单据类型ID',
  //   align:"center",
  //   dataIndex: 'firstBillTypeId'
  //  },
  //  {
  //   title: '源头单据类型名称',
  //   align:"center",
  //   dataIndex: 'firstBillTypeName'
  //  },
   {
    title: '要货计划编码',
    align:"center",
    dataIndex: 'requisitionPlanCode'
   },
   {
    title: '计划员',
    align:"center",
    dataIndex: 'schemer'
   },
  //  {
  //   title: '计划员id',
  //   align:"center",
  //   dataIndex: 'schemerId'
  //  },
   {
    title: '按供应商总汇',//0否 1是
    align:"center",
    dataIndex: 'summarySupplier',
    customRender: ({ text }) => {
      return text === 1 ? "是" : text === 0 ? '否' : ''
    },
   },
   {
    title: '按料品总汇',//0否 1是
    align:"center",
    dataIndex: 'summaryMaterial',
    customRender: ({ text }) => {
      return text === 1 ? "是" : text === 0 ? '否' : ''
    },
   },
   {
    title: '第三方编码',
    align:"center",
    dataIndex: 'thirdPartyCode',
    ifShow: false
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '组织id',
    field: 'organizationId',
    component: 'Input',
    show: false
  },
  {
    label: '租户id',
    field: 'tenantId',
    component: 'Input',
    show: false
  },
  {
    label: '删除状态',// 0正常 1已删除
    field: 'delFlag',
    component: 'Input',
    show: false
  },
  {
    label: '单据类型ID',
    field: 'billTypeId',
    component: 'Input',
    show: false
  },
  {
    label: '单据类型',
    field: 'billTypeName',
    component: 'Input',
    slot:'billTypeSlot',
    dynamicRules: () => {
      return [
        { required: true, message: '请选择单据类型!' },
      ];
    },
  },
  {
    label: '来源id',
    field: 'srcBillId',
    component: 'Input',
    show: false
  },
  {
    label: '来源类型',
    field: 'srcBillType',
    component: 'Input',
  },
  {
    label: '来源单据编号',
    field: 'srcBillCode',
    component: 'Input',
  },
  {
    label: '来源行号',
    field: 'srcRowNumber',
    component: 'InputNumber',
  },
  {
    label: '源头单据ID',
    field: 'firstBillId',
    component: 'Input',
    show: false
  },
  {
    label: '源头单据编号',
    field: 'firstBillCode',
    component: 'Input',
  },
  {
    label: '源头单据类型ID',
    field: 'firstBillTypeId',
    component: 'Input',
    show: false
  },
  {
    label: '源头单据类型名称',
    field: 'firstBillTypeName',
    component: 'Input',
    show: false
  },
  {
    label: '要货计划编码',
    field: 'requisitionPlanCode',
    component: 'Input',
  },
  {
    label: '计划员',
    field: 'schemer',
    component: 'Input',
  },
  {
    label: '计划员id',
    field: 'schemerId',
    component: 'Input',
    show: false
  },
  {
    label: '按供应商总汇',//0否 1是
    field: 'summarySupplier',
    component: 'Select',
    defaultValue: 0,
    componentProps: {
      options: [
        { value: 0, label: '否' },
        { value: 1, label: '是' },
      ],
      stringToNumber: true,
    }
  },
  {
    label: '按料品总汇',//0否 1是
    field: 'summaryMaterial',
    component: 'Select',  
    defaultValue: 0,
    componentProps: {
      options: [
        { value: 0, label: '否' },
        { value: 1, label: '是' },
      ],
      stringToNumber: true,
    }
  },
  {
    label: '第三方编码',
    field: 'thirdPartyCode',
    component: 'Input',
    ifShow: false
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const basRequisitionPlanSonColumns: JVxeColumn[] = [
    {
      title: '组织id',
      key: 'organizationId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '租户id',
      key: 'tenantId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '删除状态',//0正常 1已删除
      key: 'delFlag',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '单据类型ID',
      key: 'billTypeId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '单据类型',
      key: 'billTypeName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源id',
      key: 'srcBillId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源类型',
      key: 'srcBillType',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源单据编号',
      key: 'srcBillCode',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源行号',
      key: 'srcRowNumber',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据ID',
      key: 'firstBillId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据编号',
      key: 'firstBillCode',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据类型ID',
      key: 'firstBillTypeId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据类型名称',
      key: 'firstBillTypeName',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '行号',
      key: 'rowNum',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '要货计划id',
      key: 'orderScheduleId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '产品编码',
      key: 'productCode',
      type: JVxeTypes.slot,
      width:"200px",
      slotName: 'productName',
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '产品Id',
      key: 'productId',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '产品名称',
      key: 'productName',
      type: JVxeTypes.normal,
      width:"200px"
    },
    {
      title: '需求日期',
      key: 'demandedDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '需求数量',
      key: 'quantityRequired',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '第三方编码',
      key: 'thirdPartyCode',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '备注',
      key: 'remark',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}